<template>
  <div>
    <van-list v-model="loading"
              :finished="finished"
              :immediate-check="false"
              finished-text="没有更多了"
              @load="getWithdrawList">
      <van-cell v-for="item in list" :key="item.id" title="提现到微信钱包" :value="item.price  * 100 | yuan">
        <template #label>
          <div class="withdraw_list_label">
            <div id="label1">
              {{item.status == 0 ? '提现审核中' : (item.status == 1 ? '提现成功' : '提现失败')}}
            </div>
            <div id="label2">
              {{item.addTime}}
            </div>
          </div>
        </template>
      </van-cell>
    </van-list>
  </div>
</template>

<script>
import {withdrawList} from '@/api/api';
import {List, Panel} from 'vant';

export default {
  name: 'user-withdraw-list',
  created() {
    this.init();
  },
  data() {
    return {
      list: [],
      page: 0,
      limit: 10,
      loading: false,
      finished: false
    };
  },

  methods: {
    init() {
      this.page = 0;
      this.list = [];
      this.getWithdrawList();
    },
    getWithdrawList() {
      this.page++;

      withdrawList({
        status: this.activeIndex,
        page: this.page,
        limit: this.limit
      }).then(res => {
        this.list.push(...res.data.data.list);
      });
    },
    handleTabClick() {
      this.page = 0;
      this.list = [];
      this.getWithdrawList();
    }
  },
  components: {
    [Panel.name]: Panel,
    [List.name]: List,
  }
};
</script>
<style lang="scss" scoped>
.van-cell__value{
  color: red;
  font-size: 20px;
}
</style>
